package com.redis.springtest;

import com.redis.springtest.config.RedisConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.redis.core.HyperLogLogOperations;
import org.springframework.data.redis.core.RedisTemplate;

public class AppRedisHyperLogLog {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(RedisConfig.class);
        final RedisTemplate redisTemplate = ctx.getBean(RedisTemplate.class);

        HyperLogLogOperations logOperations = redisTemplate.opsForHyperLogLog();

        logOperations.add("hyperlog", "a", "b", "c", "d", "a");
        logOperations.add("hyperlog2", "a");
        logOperations.add("hyperlog2", "z");
        Long size = logOperations.size("hyperlog");
        System.out.println(size);
        Long size1 = logOperations.size("hyperlog2");
        System.out.println(size1);
        logOperations.union("des_key", "hyperlog", "hyperlog2");
        Long des_key = logOperations.size("des_key");
        System.out.println(des_key);
    }
}
